From 247c4cecfc22c9ee73ad98c3eb796efc91c217b5 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Mon, 16 Sep 2013 12:33:56 +0200 Subject: [PATCH] Don't ever return BASELINE from gtk_widget_get_halign This is the same behaviour as gtk_widget_get_valign, except we have no gtk_wiget_get_halign_with_baseline, as baselines make no sense for halign. Without this some widgets (like e.g. GtkOverlay) crash if you accidentally set a BASELINE halign. --- gtk/gtkwidget.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 213a3fe5c3..a2e5e3c662 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -13859,13 +13859,24 @@ gtk_widget_real_get_width_for_height (GtkWidget *widget, * * Gets the value of the #GtkWidget:halign property. * + * For backwards compatibility reasons this method will never return + * %GTK_ALIGN_BASELINE, but instead it will convert it to + * %GTK_ALIGN_FILL. Baselines are not supported for horizontal + * alignment. + * * Returns: the horizontal alignment of @widget */ GtkAlign gtk_widget_get_halign (GtkWidget *widget) { + GtkAlign align; + g_return_val_if_fail (GTK_IS_WIDGET (widget), GTK_ALIGN_FILL); - return _gtk_widget_get_aux_info_or_defaults (widget)->halign; + + align = _gtk_widget_get_aux_info_or_defaults (widget)->halign; + if (align == GTK_ALIGN_BASELINE) + return GTK_ALIGN_FILL; + return align; } /** -- 2.30.2